﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VSA.Applications.VSA.WebService;


namespace VSA.Applications
{
    public partial class SelectActivityList : Form
    {
        MainService _ActivityService = WebServiceFactory.GetService();
        public SelectActivityList()
        {
            InitializeComponent();
            gv_Activities.AutoGenerateColumns = false;
            _ActivityService.GetActivityListAsync("");
            _ActivityService.GetActivityListCompleted += new GetActivityListCompletedEventHandler(GetActivityListCompleted);
        }

        void GetActivityListCompleted(object sender, GetActivityListCompletedEventArgs e)
        {
            gv_Activities.DataSource = e.Result.Tables[0];
        }

        private void gv_Activities_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string activity = (this.Owner as CompanyInfoForm).ActivityList;
            if (!string.IsNullOrEmpty(activity))
                (this.Owner as CompanyInfoForm).ActivityList += "," + gv_Activities.Rows[e.RowIndex].Cells[1].Value.ToString();
            else
                (this.Owner as CompanyInfoForm).ActivityList = gv_Activities.Rows[e.RowIndex].Cells[1].Value.ToString();
        }
    }
}
